package com.trace.pplos.parse.dao.dataobject;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;

public class CzrkInfo {
    private static final Logger logger = LoggerFactory.getLogger(CzrkInfo.class);

    private Integer id;

    private Integer typt;

    private String xm;

    private String gmsfhm;

    private String hjAddr;

    private String job;

    private String telephone;

    private String jzAddr;

    private String buildingName;

    private String houseCode;

    private String buildingCode;

    private String unit;

    private String floor;

    private String roomCode;

    private Integer personNum;

    private String cjdw;

    private Date gmtCreate;

    private String gmtCreateUser;

    private Date gmtModified;

    private String gmtModifiedUser;

    private Integer status;

    public CzrkInfo(Integer id, Integer typt, String xm, String gmsfhm, String hjAddr, String job, String telephone, String jzAddr, String buildingName, String houseCode, String buildingCode, String unit, String floor, String roomCode, Integer personNum, String cjdw, Date gmtCreate, String gmtCreateUser, Date gmtModified, String gmtModifiedUser, Integer status) {
        this.id = id;
        this.typt = typt;
        this.xm = xm;
        this.gmsfhm = gmsfhm;
        this.hjAddr = hjAddr;
        this.job = job;
        this.telephone = telephone;
        this.jzAddr = jzAddr;
        this.buildingName = buildingName;
        this.houseCode = houseCode;
        this.buildingCode = buildingCode;
        this.unit = unit;
        this.floor = floor;
        this.roomCode = roomCode;
        this.personNum = personNum;
        this.cjdw = cjdw;
        this.gmtCreate = gmtCreate;
        this.gmtCreateUser = gmtCreateUser;
        this.gmtModified = gmtModified;
        this.gmtModifiedUser = gmtModifiedUser;
        this.status = status;
    }

    public CzrkInfo() {
        super();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getTypt() {
        return typt;
    }

    public void setTypt(Integer typt) {
        this.typt = typt;
    }

    public String getXm() {
        return xm;
    }

    public void setXm(String xm) {
        this.xm = xm == null ? null : xm.trim();
    }

    public String getGmsfhm() {
        return gmsfhm;
    }

    public void setGmsfhm(String gmsfhm) {
        this.gmsfhm = gmsfhm == null ? null : gmsfhm.trim();
    }

    public String getHjAddr() {
        return hjAddr;
    }

    public void setHjAddr(String hjAddr) {
        this.hjAddr = hjAddr == null ? null : hjAddr.trim();
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job == null ? null : job.trim();
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone == null ? null : telephone.trim();
    }

    public String getJzAddr() {
        return jzAddr;
    }

    public void setJzAddr(String jzAddr) {
        this.jzAddr = jzAddr == null ? null : jzAddr.trim();
    }

    public String getBuildingName() {
        return buildingName;
    }

    public void setBuildingName(String buildingName) {
        this.buildingName = buildingName == null ? null : buildingName.trim();
    }

    public String getHouseCode() {
        return houseCode;
    }

    public void setHouseCode(String houseCode) {
        this.houseCode = houseCode == null ? null : houseCode.trim();
    }

    public String getBuildingCode() {
        return buildingCode;
    }

    public void setBuildingCode(String buildingCode) {
        this.buildingCode = buildingCode == null ? null : buildingCode.trim();
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit == null ? null : unit.trim();
    }

    public String getFloor() {
        return floor;
    }

    public void setFloor(String floor) {
        this.floor = floor == null ? null : floor.trim();
    }

    public String getRoomCode() {
        return roomCode;
    }

    public void setRoomCode(String roomCode) {
        this.roomCode = roomCode == null ? null : roomCode.trim();
    }

    public Integer getPersonNum() {
        return personNum;
    }

    public void setPersonNum(Integer personNum) {
        this.personNum = personNum;
    }

    public String getCjdw() {
        return cjdw;
    }

    public void setCjdw(String cjdw) {
        this.cjdw = cjdw == null ? null : cjdw.trim();
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public String getGmtCreateUser() {
        return gmtCreateUser;
    }

    public void setGmtCreateUser(String gmtCreateUser) {
        this.gmtCreateUser = gmtCreateUser == null ? null : gmtCreateUser.trim();
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    public String getGmtModifiedUser() {
        return gmtModifiedUser;
    }

    public void setGmtModifiedUser(String gmtModifiedUser) {
        this.gmtModifiedUser = gmtModifiedUser == null ? null : gmtModifiedUser.trim();
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public static CzrkInfo toBean(String object){
        try{
            CzrkInfo info = new CzrkInfo();
            JSONObject record = JSON.parseObject(object);
            info.setTypt(record.getInteger("rklx"));
            info.setXm(record.getString("ryxm"));
            info.setGmsfhm(record.getString("sfzh"));
            info.setHjAddr(record.getString("hjdz"));
            info.setJob(record.getString("ryzy"));
            info.setTelephone(record.getString("dhhm"));
            info.setJzAddr(record.getString("xjdz"));
            info.setBuildingName(record.getString("xqmc"));
            info.setHouseCode(record.getString("mphm"));
            info.setBuildingCode(record.getString("lh"));
            info.setUnit(record.getString("dy"));
            info.setFloor(record.getString("lc"));
            info.setRoomCode(record.getString("fh"));
            info.setPersonNum(record.getInteger("jzrs"));
            info.setGmtCreate(record.getDate("createdAt"));
            info.setGmtCreateUser(record.getString("createdBy"));
            //info.setGmtModified(record.getDate("modifiedAt"));
            info.setGmtModified(new Date());
            info.setGmtModifiedUser(record.getString("modifiedBy"));
            return info;
        }catch (Exception e){
            logger.error(e.getMessage(), e);
        }
        return null;
    }
}